package com.javasea.business.service;

import com.javasea.business.feign.OrderFeignClient;
import com.javasea.business.feign.StorageFeignClient;
import io.seata.core.context.RootContext;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;

@Slf4j
@Service
public class Business2Service {

    @Resource
    private StorageFeignClient storageFeignClient;
    @Resource
    private OrderFeignClient orderFeignClient;

    @Autowired
    private Business3Service business3Service;
    /**
     * 减库存，下订单
     * @param userId
     * @param commodityCode
     * @param orderCount
     */
    @Transactional(rollbackFor = Exception.class)
    public void purchase(String userId, String commodityCode, int orderCount) {
        aa(userId, commodityCode, orderCount);
    }
    @Transactional(rollbackFor = Exception.class)
    public void aa(String userId, String commodityCode, int orderCount) {
        business3Service.purchase(userId, commodityCode, orderCount);
    }

}
